package com.example.glgk.controller.gather;

import com.example.glgk.dto.EscalationDeptData;
import com.example.glgk.dto.QueryEscalation;
import com.example.glgk.dto.gather.ClinicalGatherDataDto;
import com.example.glgk.service.gather.ClinicalGatherService;
import com.example.glgk.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author lxk
 */
@Api(tags = "临床科室指标查询接口")
@Slf4j
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/ClinicalGatherController")
public class ClinicalGatherController {

    @Autowired
    ClinicalGatherService clinicalGatherService;


    @PostMapping("/queryClinicalData")
    @ApiOperation(value = "临床科室指标查询接口")
    public List<ClinicalGatherDataDto> queryClinicalData(@RequestBody QueryEscalation queryEscalation){
        return clinicalGatherService.queryClinicalData(queryEscalation);
    }

    @ApiOperation(value = "临床科室指标查询导出Excel")
    @PostMapping("/export")
    public void export(@RequestBody QueryEscalation queryEscalation, HttpServletResponse response){
        clinicalGatherService.export(queryEscalation,response);
    }


    @PostMapping("/queryClinicalIndicatorData")
    @ApiOperation(value = "临床科室指标查询接口")
    public R queryClinicalIndicatorData(@RequestBody QueryEscalation queryEscalation){
        return R.ok().put("page",clinicalGatherService.queryClinicalIndicatorData(queryEscalation));
    }

    @PostMapping("/queryGatherClinicalIndicatorData")
    @ApiOperation(value = "指标查询汇总-科室数据接口")
    public List<EscalationDeptData> queryGatherClinicalIndicatorData(@RequestBody QueryEscalation queryEscalation){
        return clinicalGatherService.queryGatherClinicalIndicatorData(queryEscalation);
    }

    @ApiOperation(value = "临床科室指标查询导出Excel")
    @PostMapping("/exportClinicalData")
    public void exportClinicalData(@RequestBody QueryEscalation queryEscalation, HttpServletResponse response){
        clinicalGatherService.exportClinicalData(queryEscalation,response);
    }

}
